# Subrotine used to set the properly gain and readout depending on
# the choice of the readout rate and the attenuation.
# Written by Sergio Scarano Jr (scaranojr@ctio.noao.edu) mar 2010.

if rr == '400':
    readout=400  # kHz
    gain=5.67    # e-/ADU
    rnoise=8.62  # e-
    t_img=24     # s
    t_spec=20    # s
elif (rr == '200' and att == '0'):
    readout=200  # kHz
    gain=1.4     # e-/ADU
    rnoise=4.74  # e-
    t_img=48     # s
    t_spec=40    # s
elif (rr == '200' and att == '2'):
    readout=200  # kHz
    gain=2.67    # e-/ADU
    rnoise=5.12  # e-
    t_img=48     # s
    t_spec=40    # s
elif (rr == '100' and att == '0'):
    readout=100  # kHz
    gain=0.56    # e-/ADU
    rnoise=3.69  # e-
    t_img=96     # s
    t_spec=79    # s
elif (rr == '100' and att == '2'):
    readout=100  # kHz
    gain=1.06    # e-/ADU
    rnoise=3.72  # e-
    t_img=96     # s
    t_spec=79    # s
elif (rr == '100' and att == '3'):
    readout=100  # kHz
    gain=2.06    # e-/ADU
    rnoise=3.99  # e-
    t_img=96     # s
    t_spec=79    # s
elif (rr == '50' and att == '0'):
    readout=50   # kHz
    gain=0.25    # e-/ADU
    rnoise=3.33  # e-
    t_img=192    # s
    t_spec=157   # s
elif (rr == '50' and att == '2'):
    readout=50   # kHz
    gain=0.47    # e-/ADU
    rnoise=3.35  # e-
    t_img=192    # s
    t_spec=157   # s
elif (rr == '50' and att == '3'):
    readout=50   # kHz
    gain=0.91    # e-/ADU
    rnoise=3.41  # e-
    t_img=192    # s
    t_spec=157   # s
